<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>CREATE EVENT HANDLER</title>
</head>

<body>
	<?php
		$username = $_COOKIE['studialusername'];
		$password = $_COOKIE['studialuserpwd'];
		$userid = $_COOKIE['studialuserid'];
		$courseid = $_POST['courseid'];
		$eventName = $_POST['eventName'];
		$description = $_POST['description'];
		
		$startDay = $_POST['startDay'];
		$startMonth = $_POST['startMonth'];
		$startYear = $_POST['startYear'];
		
		$finishDay = $_POST['finishDay'];
		$finishMonth = $_POST['finishMonth'];
		$finishYear = $_POST['finishYear'];
		
		$path = $_POST['path'];
			
		@ $db = mysql_pconnect("localhost","root","");
			
		if(!$db)
		{
			echo "<h2>Database does not exist!</h2>";
			exit;
		}
		
		$now = getdate();
		
		$query = "INSERT INTO `Studial`.`assgnments` (`course_id`, `name`, `description`, `startdate`, `finishdate`, `path`) VALUES ('".$courseid."', '".$eventName."', '".$description."', '".$courseName."', '".$startDay."-".$startMonth."-".$startYear."', '".$finishDay."-".$finishMonth."-".$finishYear."', '".$path."')";
		mysql_query($query);
		
		header("location: ../studial/courses/homeboard.php?id=".$courseid);
	?>
</body>
</html>